AS Declaration Statements Declare the variable in a declaration having the form declare variablename AS type where the "declare" can be either DIM, COMMON, REDIM (for arrays), SHARED, or STATIC, and the "type" can be either INTEGER, LONG, SINGLE, DOUBLE, STRING, or a user-defined type. For example, the following statement declares the variable A as having a long-integer type: DIM A AS LONG String variables declared in an AS STRING clause can be either variable- length strings or fixed-length strings. Variable-length strings are expandable: their length depends on the length of any string assigned to them. Fixed-length strings have a constant length, specified by adding "* number" to the AS STRING clause, where number is the length of the string in bytes. For example: ' String1 can have a variable length: DIM String1 AS STRING ' String2 has a fixed length of 7 bytes. DIM String2 AS STRING * 7 String1 = "1234567890" String2 = "1234567890" PRINT String1 PRINT String2 Output: 1234567890 1234567 Declare record variables by using the name of the user type in the AS clause: TYPE InventoryItem Description AS STRING * 25 Number AS STRING * 10 Quantity AS LONG OrderPoint AS LONG END TYPE DIM CurrentItem AS InventoryItem, PreviousItem AS InventoryItem To refer to individual elements of the new variable, use the format variablename.elementname as in the following example: IF CurrentItem.Description = "Ergonomic Desk Chair" THEN PRINT CurrentItem.Number; CurrentItem.Quantity END IF Note: If you declare a variable with an AS clause, every declaration of the variable must use the AS clause. For example, in the following fragment the AS clause is required in the COMMON statement because AS was used in the DIM statement: CONST MAXEMPLOYEES = 250 DIM EmpNames(MAXEMPLOYEES) AS STRING COMMON EmpNames() AS STRING . . .